<template>
  <div class="bg_write user-record">
    <el-row>
      <el-row class="base_content_title">
        <el-col :span="24" class="content_title">
          <el-col :span="12">
            <HeadTitle></HeadTitle>
          </el-col>
        </el-col>
      </el-row>
    </el-row>
    <el-row class="pd_20">
      <el-table
        ref="multipleTable"
        :data="record_list"
        style="width: 99.9%"
        v-loading="loading"
        stripe
        header-row-class-name="head_color"
        tooltip-effect="dark"
      >
        <el-table-column label="数据量">
          <template slot-scope="scope">{{scope.row.num}}</template>
        </el-table-column>
        <el-table-column label="导入时间">
          <template slot-scope="scope">{{scope.row.stage |getTimeFormat}}</template>
        </el-table-column>

        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="danger" size="mini" @click="del_list_detail(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-row>
  </div>
</template>
<script>
import HeadTitle from "@/components/currency/HeadTitle.vue";
export default {
  name: "user_in_record",
  data() {
    return {
      loading: false,
      record_list: [
        {
          num: "200", //数据量
          in_time: "2019.07.08 12:00" //导入时间
        },
        {
          num: "250", //数据量
          in_time: "2019.07.09 18:00" //导入时间
        }
      ],
    };
  },
  components: {
    HeadTitle
  },
  created() {
    this.get_in_record();
  },
  methods: {
    get_in_record() {
      this.$api.getUser.get_timelist({}).then(res => {
        if (res.data.code == 200) {
          this.record_list = res.data.result;
          console.log(this.record_list);
        } else {
          console.log(res.data.result);
        }
      });
    },
    del_list_detail(item) {
      this.$swal({
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思"
      }).then(willDelete => {
        if (willDelete.value) {
          var data = { stage: item.stage };
          this.$api.getUser.det_timelist(data).then(res => {
            if (res.data.code == 200) {
              this.$swal("删除成功！", "您已经删除了这些信息。", "success");
              this.get_in_record();
            } else {
              this.$swal("删除失败！", "出错啦！", "success");
              this.get_in_record();
            }
          });
        }
      });
    }
  }
};
</script>
<style  scoped>
</style>
